package net.lab1024.sa.admin.module.business.erp.controller;

import net.lab1024.sa.admin.module.business.erp.domain.entity.MmordEntity;
import net.lab1024.sa.admin.module.business.erp.domain.entity.NmmordEntity;
import net.lab1024.sa.admin.module.business.erp.domain.form.add.NmmordAddForm;
import net.lab1024.sa.admin.module.business.erp.domain.form.query.NmmordQueryForm;
import net.lab1024.sa.admin.module.business.erp.domain.form.update.NmmordUpdateForm;
import net.lab1024.sa.admin.module.business.erp.domain.vo.NmmordVO;
import net.lab1024.sa.admin.module.business.erp.service.NmmordService;
import net.lab1024.sa.base.common.domain.ValidateList;
import org.springframework.web.bind.annotation.*;
import net.lab1024.sa.base.common.domain.ResponseDTO;
import net.lab1024.sa.base.common.domain.PageResult;
import io.swagger.v3.oas.annotations.tags.Tag;
import io.swagger.v3.oas.annotations.Operation;

import javax.annotation.Resource;
import javax.validation.Valid;

/**
 * erp生产订单与对应表 Controller
 *
 * @Author AKITA
 * @Date 2025-04-19 13:00:24
 * @Copyright AKITA
 */

@RestController
@Tag(name = "erp生产订单与对应表")
public class NmmordController {

    @Resource
    private NmmordService nmmordService;

    @Operation(summary = "分页查询 @author AKITA")
    @PostMapping("/nmmord/queryPage")

    public ResponseDTO<PageResult<NmmordVO>> queryPage(@RequestBody @Valid NmmordQueryForm queryForm) {
        return ResponseDTO.ok(nmmordService.queryPage(queryForm));
    }

    @Operation(summary = "添加 @author AKITA")
    @PostMapping("/nmmord/add")

    public ResponseDTO<Long> add(@RequestBody @Valid NmmordAddForm addForm) {
        return nmmordService.add(addForm);
    }

    @Operation(summary = "更新 @author AKITA")
    @PostMapping("/nmmord/update")

    public ResponseDTO<String> update(@RequestBody @Valid NmmordUpdateForm updateForm) {
        return nmmordService.update(updateForm);
    }

    @Operation(summary = "批量删除 @author AKITA")
    @PostMapping("/nmmord/batchDelete")

    public ResponseDTO<String> batchDelete(@RequestBody ValidateList<Long> idList) {
        return nmmordService.batchDelete(idList);
    }

    @Operation(summary = "单个删除 @author AKITA")
    @GetMapping("/nmmord/delete/{docEntry}")

    public ResponseDTO<String> batchDelete(@PathVariable Long docEntry) {
        return nmmordService.delete(docEntry);
    }


    @Operation(summary = "单个查询 @author AKITA")
    @GetMapping("/nmmord/info/{docEntry}")
    public ResponseDTO<NmmordEntity> info(@PathVariable Long docEntry) {
        return nmmordService.info(docEntry);
    }

    @GetMapping("/nmmord/batchInsert")
    public ResponseDTO<NmmordEntity> batchInsert(@RequestParam("docEntry") Long docEntry) {
        return nmmordService.batchInsert(docEntry);
    }

}
